#include "dramaFactory.h"

DramaFactory::DramaFactory()
{
	nowFps = nextFps = 0;
	int addtime;
	string str = _drama.getCmd();
	stringstream ss(str);
	ss >> str;
	if (str == "wait")
	{
		ss >> addtime;
		nextFps += addtime;
	}
}

void DramaFactory::getNextMessage()
{
	string str = _drama.getCmd();
	if (str != "empty")
	{
		stringstream ss(str);
		ss >> str;
		if (str == "wait")
		{
			_m.flag = WAIT;
			int temp;
			ss >> temp;
			nextFps += temp;
		}else
		if (str == "createEmeny")
		{
			_m.flag = CREATEENEMY;
			int a2,a3;
			ss >> _m.emenyKind >> a2 >>a3;
			_m.p.setPoint(a2,a3);
		}else 
		if (str == "changeBackGround")
		{
			_m.flag = CHANGEBACKGROUND;
			ss >> _m.emenyKind;
		}else if (str == "changeBgm")
		{
			_m.flag = CHANGEBGM;
			ss >> _m.emenyKind;
		}else if (str == "addEffect")
		{
			_m.flag = ADDEFFECT;
			ss >> _m.emenyKind;
		}else if (str == "setLogo")
		{
			_m.flag = SETLOGO;
			ss >> _m.str;
		}else if (str == "createBoss")
		{
			_m.flag = CREATEBOSS;
			ss >> _m.emenyKind;
		}
	}else
	{
		_m.flag = NULL;
	}
}